import subprocess
import os

main = "./testmain"
if os.path.exists(main):
    out = subprocess.check_output(main)
    print('rc = %s' % ( out))

print('*' * 10)
f = os.popen(main)
data = f.readlines()
f.close()
print(data)

print('*' * 10)
os.system(main)